package com.zn.web.rpc;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.zn.util.HttpClientUtil;
import com.zn.vo.Response;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.TimeZone;

/**
 * @author YinJiaWei
 * @version 2018/8/25 20:12
 */
@Component
public class TradeDateCall {
    private static final Logger LOGGER = LoggerFactory.getLogger(TradeDateCall.class);
    @Value("${jiejiari.url}")
    private String url;
    @Value("${jiejiari.interface.checkholiday}")
    private String checkHoliday;
    private static final ObjectMapper MAPPER = new ObjectMapper();
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    static {
        MAPPER.setTimeZone(TimeZone.getTimeZone("GMT+8"));
    }
    public Response checkHoliday(String date){
        Response response = HttpClientUtil.post(url,
                HttpClientUtil.Builder.builder(checkHoliday)
                        .with("date", date)
        );
        return response;
    }
}
